<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui" xmlns:m="http://www.ol4jsf.org">


<link type="text/css" rel="stylesheet" href="css/config.css" />
<script type="text/javascript"
	src="http://maps.google.com/maps/api/js?sensor=false"></script>
<link rel="stylesheet" type="text/css" href="structure.css" />

<script type="text/javascript" src="locale-primefaces.js"></script>

<style>
.estiloMensagem {
	font-weight: bold;
	color: blue;
	font-size: 12px;
	font-weight: bold;
}

.estiloMensagem22 {
	font-weight: bold;
	color: red;
	font-size: 11px;
	font-weight: bold;
}

.estiloMensagem2 {
	font-weight: bold;
	font-size: 11px;
}
</style>

<h:head>
	<title>Rastreamento</title>
</h:head>
<f:view contentType="text/html">
	<h:body>
	


		<p:layout fullPage="true">
			<p:layoutUnit position="center">


				<!-- MENU  -->
				<h:form id="mapaform">
				<img src="./img/2.jpg" class="bg"/>
					<p:menubar>


						<p:submenu label="Cadastros" rendered="#{login.per}" >

							<p:menuitem value="Usuario" url="#" styleClass="open"
								rendered="#{login.menu}" onclick="user.show();"></p:menuitem>
							<p:menuitem value="Permisão Usuario" url="#" styleClass="open"
								onclick="user_per.show();" rendered="#{login.per2}"></p:menuitem>
							<p:menuitem value="Veiculos/Rastreador" url="#" styleClass="open"
								update="DlgVeiculo" rendered="#{login.menu}"
								onclick="veiculo.show();"></p:menuitem>
							<!-- 							<p:menuitem value="Manutenção" url="#" styleClass="open" -->
							<!-- 								onclick="manu.show();"></p:menuitem>  -->
						</p:submenu>

						<p:submenu label="Mapa">
							<p:menuitem value="Localização" onclick="rota.show();"
								update=":formMap" styleClass="undo" helpText="‚åòZ"></p:menuitem>
							<p:menuitem value="Cerca virtual" onclick="cerca.show();"
								rendered="#{login.per}" styleClass="redo" helpText="‚åòY"></p:menuitem>
						</p:submenu>

						<p:submenu label="Relatorios" rendered="#{login.per}">
							<p:menuitem value="Rota diaria" onclick="relatorio_rota.show();"
								update=":dadosRelatorio:carros,:formRelatorioMap:mapaRelatorio,:dadosRelatorio,:formRelatorioMap"></p:menuitem>
							<p:menuitem value="Notificação velocidade" onclick="noti.show();"></p:menuitem>
							<p:menuitem value="Cerca virtual" onclick="noticerca.show();"></p:menuitem>


						</p:submenu>


						<p:submenu label="Sair">
							<p:menuitem value="Sair"
								actionListener="#{limparSessaoBean.limparSession}"
								action="RESTART" styleClass="undo" helpText="‚åòZ"></p:menuitem>
						</p:submenu>


					</p:menubar>

					
					

				</h:form>


				<!-- LOCALIZAÇÃO  -->

				<p:dialog header="Localização Atual" widgetVar="rota"
					hideEffect="fade" showEffect="fade" resizable="false" height="610"
					width="830">


					<h:form id="formMap">

						<h:graphicImage value="/icones/legenda.jpg"></h:graphicImage>

						<h:panelGrid columns="3">
							<h:outputLabel>Filtro Veiculo(s):</h:outputLabel>
							<p:selectCheckboxMenu value="#{mapBean.arrayListFiltro}"
								label="Placa" filter="true" filterText="Filter"
								filterMatchMode="startsWith" panelStyle="width:220px">
								<f:selectItems value="#{controllBean.carros}" />
							</p:selectCheckboxMenu>

							<p:commandButton value="Filtrar"
								actionListener="#{mapBean.buscarposicao}"
								update="formMap:mapa,:formAlerta">
							</p:commandButton>

						</h:panelGrid>


						<h:messages id="messages" styleClass="estiloMensagem22">
						</h:messages>
						<p:gmap center="#{mapBean.decimalflat},#{mapBean.decimalflong}"
							zoom="#{mapBean.zom}" type="ROADMAP" id="mapa"
							model="#{mapBean.advancedModel}" style="width:800px;height:550px">

							<!-- <p:ajax event="overlaySelect"
								listener="#{mapBean.onMarkerSelect}" />

							<p:gmapInfoWindow>

								<p:outputPanel style="display:block;margin:auto:">

									<h:panelGrid columns="1" cellspacing="2">
										<h:outputText value="#{mapBean.nm}" />
										<h:outputText value="#{mapBean.placa}" />
										<h:outputText value="#{mapBean.modelo}" />
										<h:outputText value="#{mapBean.velocidade}" />
										<h:outputText value="#{mapBean.dt}" />
										<h:outputText value="#{mapBean.hora}" />
									</h:panelGrid>

								</p:outputPanel>

							</p:gmapInfoWindow> -->
						</p:gmap>


						<p:poll interval="60" listener="#{mapBean.buscarposicao}"
							update="formMap:mapa,:formAlerta" />



					</h:form>

				</p:dialog>


				<p:dialog showHeader="false" visible="#{mapBean.alerta}" closable="false"
					widgetVar="alertaPanel" id="digAlerta" width="200" height="200"
					resizable="false" showEffect="fade" style="margin-right:1800px; margin-top:300px;" >
					Notificações
					<h:form id="formAlerta">
						<p:panel rendered="#{mapBean.pvel}">
							<h:outputText value="#{mapBean.mvel}"></h:outputText>
						</p:panel>

						<p:panel rendered="#{mapBean.pcer}">
							<h:outputText value="#{mapBean.mcer}"></h:outputText>
						</p:panel>

					</h:form>

				</p:dialog>



				<!-- CERCA   -->

				<p:dialog header="Cerca Virtual" widgetVar="cerca" showEffect="fade"
					hideEffect="fade" height="450" width="800" resizable="false" minimizable="true">
					<h:form id="CercaForm">
						<p:growl id="cercaGrow" />

						<h:panelGrid columns="9">

							<h:outputLabel>Veiculo(s):</h:outputLabel>
							<p:selectCheckboxMenu value="#{cercaControll.carrosselecionados}"
								label="Placa" filter="true" filterText="Filter" required="true"
								filterMatchMode="startsWith" panelStyle="width:220px">
								<f:selectItems value="#{controllBean.carros}" />
							</p:selectCheckboxMenu>

							<h:outputText value="Estado: " />
							<p:selectOneMenu value="#{cercaControll.estadoSelecionado}"
								immediate="true">
								<f:selectItem itemLabel="Selecione estado" />
								<f:selectItems value="#{cercaControll.estados2}" />
								<p:ajax event="change" update="cidadesList"
									listener="#{cercaControll.buscarCidades}" />
							</p:selectOneMenu>

							<h:outputLabel>Cidades(s):</h:outputLabel>
							<p:selectCheckboxMenu
								value="#{cercaControll.cidadesselecionadas}" label="Cidades"
								filter="true" filterText="Filter" required="true"
								id="cidadesList" filterMatchMode="startsWith"
								panelStyle="width:220px">

								<f:selectItems value="#{cercaControll.cidades2}" />
							</p:selectCheckboxMenu>

							<h:outputLabel>Email:</h:outputLabel>
							<h:inputText value="#{cercaControll.emailCerca}" size="30"
								required="true"></h:inputText>

							<p:commandButton value="Cadastrar"
								actionListener="#{cercaControll.insertcerca}"
								update="cercaGrow,:CercaForm,CercaForm:dataTableCerca"></p:commandButton>

						</h:panelGrid>


						<p:dataTable var="cer" value="#{cercaControll.listaCercas}"
							rows="12" id="dataTableCerca" paginator="true"
							selection="#{cercaControll.cercaSelecionada}"
							selectionMode="single" rowKey="#{cer.id}">

							<p:ajax event="rowSelect" listener="#{cercaControll.onRowSelect}"
								update=":CercaFormEdit:display" oncomplete="cercaedit.show()" />


							<p:column headerText="Veiculo:" width="100">

								<h:outputText value="#{cer.imei.modelo}" />

							</p:column>

							<p:column headerText="Placa:" width="100">

								<h:outputText value="#{cer.imei.placa}" />

							</p:column>

							<p:column headerText="Cidade Cerca:" width="100">
								<h:outputText value="#{cer.cidade}" />


							</p:column>
							<p:column width="140" headerText="Email">

								<h:outputText value="#{cer.email}" />

							</p:column>

							<p:column headerText="Alerta" width="60">

								<h:outputText value="#{cer.emailboolean}" />

							</p:column>




						</p:dataTable>



					</h:form>


					<p:dialog header="Editor Cerca Virtual" widgetVar="cercaedit"
						showEffect="fade" hideEffect="fade" width="400" height="200"
						resizable="false">
						<h:form id="CercaFormEdit">
							<h:panelGrid id="display" columns="2">


								<h:outputLabel>Veiculo:</h:outputLabel>
								<h:inputText
									value="#{cercaControll.cercaSelecionada.imei.modelo}"
									disabled="true"></h:inputText>

								<h:outputLabel>Cidade Cerca:</h:outputLabel>
								<h:inputText value="#{cercaControll.cercaSelecionada.cidade}"
									disabled="true" size="40"></h:inputText>

								<h:outputLabel>Email:</h:outputLabel>
								<h:inputText value="#{cercaControll.cercaSelecionada.email}"
									size="40" required="true"></h:inputText>

								<p:selectBooleanButton value="#{cercaControll.value2}"
									onLabel="Habilitado" offLabel="Desabilitado"
									onIcon="ui-icon-check" offIcon="ui-icon-close">

								</p:selectBooleanButton>
							</h:panelGrid>
							<br></br>
							<p:commandButton value="Atualizar"
								actionListener="#{cercaControll.update}"
								update=":CercaForm:dataTableCerca,:CercaForm:cercaGrow "
								oncomplete="cercaedit.hide()">
							</p:commandButton>
							<p:commandButton value="Excluir"
								actionListener="#{cercaControll.delete}"
								update=":CercaForm:dataTableCerca,:CercaForm:cercaGrow "
								oncomplete="cercaedit.hide()">
							</p:commandButton>

						</h:form>


					</p:dialog>


				</p:dialog>

				<!-- CRUD VEICULOS  -->

				<p:dialog header="Cadastro de Veiculos" widgetVar="veiculo"
					hideEffect="fade" id="DlgVeiculo" showEffect="fade" height="500"
					width="800" resizable="false">
					<h:form id="formVeiculo">
						<p:growl id="grow2" showDetail="true" sticky="true" />
						<h:outputLabel>Selecione o usuario:</h:outputLabel>
						<p:selectOneMenu value="#{controllBean.usuarioVeiculo.nome}"
							effect="fold" required="true" editable="true" id="carros"
							requiredMessage="Selecione Usuario">
							<f:selectItems value="#{controllBean.usuariosNomes}" />
						</p:selectOneMenu>

						<h:panelGrid columns="2">
							<p:panel header="Veiculo">
								<h:panelGrid columns="2">
									<h:outputLabel>Modelo Veiculo:</h:outputLabel>
									<p:inputText size="40" value="#{controllBean.imei.modelo}"></p:inputText>
									<h:outputLabel>Placa:</h:outputLabel>
									<p:inputText size="40" value="#{controllBean.imei.placa}"></p:inputText>
									<h:outputLabel>Cidade:</h:outputLabel>
									<p:inputText size="40" value="#{controllBean.imei.cidade}"></p:inputText>
									<h:outputLabel>Cor:</h:outputLabel>
									<p:inputText size="40" value="#{controllBean.imei.cor}"></p:inputText>
								</h:panelGrid>
							</p:panel>
							<p:panel header="Rastreador">
								<h:panelGrid columns="2">
									<h:outputLabel>Celular:</h:outputLabel>
									<p:inputText size="40" value="#{controllBean.imei.numero}"></p:inputText>
									<h:outputLabel>Imei:</h:outputLabel>
									<p:inputText size="40" value="#{controllBean.imei.imei}"
										required="true"></p:inputText>

									<h:outputLabel>Modelo Rastreador:</h:outputLabel>
									<p:inputText size="40" value="#{controllBean.imei.rastreador}"
										required="true"></p:inputText>

									<h:outputLabel>.</h:outputLabel>
									<h:outputLabel>.</h:outputLabel>

								</h:panelGrid>

							</p:panel>


							<p:commandButton value="Cadastrar"
								actionListener="#{controllBean.cadVeiculo}"
								update="grow2,formVeiculo,dataTableveiculo"></p:commandButton>
						</h:panelGrid>

						<br></br>
						<br></br>

						<p:dataTable var="vei" value="#{controllBean.listaVeiculos}"
							rows="5" id="dataTableveiculo" paginator="true" editable="true">

							<p:ajax event="rowEdit" listener="#{controllBean.onEditVeiculo}"
								update=":formVeiculo:grow2" />
							<p:ajax event="rowEditCancel"
								listener="#{controllBean.onCancelVeiculo}"
								update=":formVeiculo:grow2" />



							<p:column headerText="Veiculo:" width="100">
								<p:cellEditor>
									<f:facet name="output">
										<h:outputText value="#{vei.modelo}" />
									</f:facet>
									<f:facet name="input">
										<p:inputText value="#{vei.modelo}"></p:inputText>
									</f:facet>
								</p:cellEditor>
							</p:column>

							<p:column headerText="Placa:" width="100">
								<p:cellEditor>
									<f:facet name="output">
										<h:outputText value="#{vei.placa}" />
									</f:facet>
									<f:facet name="input">
										<p:inputText value="#{vei.placa}"></p:inputText>
									</f:facet>
								</p:cellEditor>
							</p:column>

							<p:column headerText="Imei:" width="100">
								<p:cellEditor>
									<f:facet name="output">
										<h:outputText value="#{vei.imei}" />
									</f:facet>
									<f:facet name="input">
										<p:inputText value="#{vei.imei}"></p:inputText>
									</f:facet>
								</p:cellEditor>
							</p:column>

							<p:column headerText="Usuario:" width="80">
								<h:outputText value="#{vei.usuario.nome}" />
							</p:column>

							<p:column headerText="Telefone/Rast:" width="80">

								<p:cellEditor>
									<f:facet name="output">
										<h:outputText value="#{vei.numero}" />
									</f:facet>
									<f:facet name="input">
										<p:inputText value="#{vei.numero}"></p:inputText>
									</f:facet>
								</p:cellEditor>
							</p:column>

							<p:column headerText="Rastreador" width="80">
								<p:cellEditor>
									<f:facet name="output">
										<h:outputText value="#{vei.rastreador}" />
									</f:facet>
									<f:facet name="input">
										<p:inputText value="#{vei.rastreador}"></p:inputText>
									</f:facet>
								</p:cellEditor>
							</p:column>

							<p:column headerText="Opções" style="width:50px">
								<p:rowEditor />
							</p:column>

						</p:dataTable>

					</h:form>



				</p:dialog>



				<!-- CRUD USUARIO  -->

				<p:dialog header="Cadastro de Usuário" widgetVar="user"
					hideEffect="fade" showEffect="fade" height="400" width="600"
					resizable="false">
					<h:form id="formUsusario">
						<p:growl id="grow1" showDetail="true" sticky="true" />
						<h:panelGrid columns="2">
							<h:outputLabel>Nome:</h:outputLabel>
							<p:inputText value="#{controllBean.usuario.nome}" size="60"></p:inputText>

							<h:outputLabel>Usuario:</h:outputLabel>
							<p:inputText value="#{controllBean.usuario.email}" size="60"
								required="true" requiredMessage="Campo obrigatorio"></p:inputText>

							<h:outputLabel>Senha:</h:outputLabel>
							<p:password value="#{controllBean.usuario.senha}" required="true"
								size="60" requiredMessage="Campo obrigatorio"></p:password>

							<h:outputLabel>Telefone:</h:outputLabel>
							<p:inputText value="#{controllBean.usuario.telefone}" size="60"
								required="true" requiredMessage="Campo obrigatorio"></p:inputText>

							<p:commandButton value="Cadastrar"
								actionListener="#{controllBean.cadUsuario}"
								update="grow1,dataTableUsuario,formUsusario,:formVeiculo:carros"></p:commandButton>
						</h:panelGrid>

						<br></br>
						<br></br>



						<p:dataTable var="usu" value="#{controllBean.listaUsuario}"
							rows="5" paginator="true" id="dataTableUsuario" editable="true">


							<p:ajax event="rowEdit" listener="#{controllBean.onEditUser}"
								update=":formUsusario:grow1" />
							<p:ajax event="rowEditCancel"
								listener="#{controllBean.onCancelUser}"
								update=":formUsusario:grow1" />

							<p:column headerText="ID" width="30">
								<p:cellEditor>
									<f:facet name="output">
										<h:outputText value="#{usu.id}" />
									</f:facet>
									<f:facet name="input">
										<p:inputText value="#{usu.id}" disabled="true"></p:inputText>
									</f:facet>
								</p:cellEditor>

							</p:column>

							<p:column headerText="Nome:" width="80">
								<p:cellEditor>
									<f:facet name="output">
										<h:outputText value="#{usu.nome}" />
									</f:facet>
									<f:facet name="input">
										<p:inputText value="#{usu.nome}"></p:inputText>
									</f:facet>
								</p:cellEditor>

							</p:column>

							<p:column headerText="Usuario" width="80">
								<p:cellEditor>
									<f:facet name="output">
										<h:outputText value="#{usu.email}" />
									</f:facet>
									<f:facet name="input">
										<p:inputText value="#{usu.email}"></p:inputText>
									</f:facet>
								</p:cellEditor>

							</p:column>

							<p:column headerText="Senha" width="80">
								<p:cellEditor>
									<f:facet name="output">
										<h:outputText value="#{usu.senha}" />
									</f:facet>
									<f:facet name="input">
										<p:inputText value="#{usu.senha}"></p:inputText>
									</f:facet>
								</p:cellEditor>
							</p:column>

							<p:column headerText="Telefone" width="80">
								<p:cellEditor>
									<f:facet name="output">
										<h:outputText value="#{usu.telefone}" />
									</f:facet>
									<f:facet name="input">
										<p:inputText value="#{usu.telefone}"></p:inputText>
									</f:facet>
								</p:cellEditor>


							</p:column>

							<p:column headerText="Opções" style="width:50px">
								<p:rowEditor />
							</p:column>
						</p:dataTable>

					</h:form>


				</p:dialog>

				<!-- FINAL CRUD USUARIO  -->



				<!-- CRUD DE MANUTENÇÂO -->

				<p:dialog header="Manutenção" widgetVar="manu" showEffect="fade"
					hideEffect="fade" height="400" width="600" resizable="false">
					<h:form id="formmanu">
						<p:growl id="growmanu" showDetail="true" sticky="true" />
						<h:panelGrid columns="2">

							<h:outputLabel>VEICULO:</h:outputLabel>
							<p:selectOneMenu value="#{relatorioMapBean.imei.placa}"
								effect="fold" required="true" editable="true" id="carros"
								requiredMessage="Selecione Placa do veiculo">
								<f:selectItem itemLabel="Selecione o veiculo" itemValue="" />
								<f:selectItems value="#{relatorioMapBean.carros}" />
							</p:selectOneMenu>

							<h:outputLabel>KM ATUAL:</h:outputLabel>
							<p:inputText size="60"></p:inputText>

							<h:outputLabel>DATA ULTIMA TROCA OLEO:</h:outputLabel>
							<p:calendar></p:calendar>

							<h:outputLabel>KM ULTIMA TROCA DE OLEO</h:outputLabel>
							<p:inputText size="60"></p:inputText>

							<h:outputLabel>DATA ULTIMA REVISÂO</h:outputLabel>
							<p:calendar></p:calendar>

							<h:outputLabel>AGENDAR PROX REVISÂO</h:outputLabel>
							<p:calendar></p:calendar>

							<h:outputLabel>AGENDAR TROCA DE PNEU</h:outputLabel>
							<p:calendar></p:calendar>



							<p:commandButton value="Cadastrar"></p:commandButton>
						</h:panelGrid>

					</h:form>
				</p:dialog>




				<!-- TELA NOTIFICAÇÃO VELOCIDADE -->

				<p:dialog header="Notificações" widgetVar="noti" id="tbl"
					showEffect="fade" hideEffect="fade" height="600" width="950"
					resizable="false">
					<p:ajax event="close" listener="#{mapBean.limparRelatorioNofitica}"
						update="notificaForm" />
					<h:form id="notificaForm">
						<p:growl id="grownotifica"></p:growl>
						<h:panelGrid columns="4">
							<h:outputText value="Periodo: ">
							</h:outputText>
							<p:calendar locale="pt" required="true" id="date1"
								requiredMessage="selecione a data " value="#{mapBean.data1}"></p:calendar>
							<p:calendar locale="pt" required="true" id="date2"
								requiredMessage="selecione a data " value="#{mapBean.data2}"></p:calendar>

							<p:commandButton value="Buscar"
								actionListener="#{mapBean.BuscarNotifica}"
								update=":notificaForm:dataTableNoti,:notificaForm:grownotifica"></p:commandButton>
						</h:panelGrid>

						<p:dataTable var="ntfica" value="#{mapBean.arrayListNotifica}"
							widgetVar="nt" rows="18" paginator="true" id="dataTableNoti"
							filteredValue="#{mapBean.arrayListNotifica}">


							<p:column headerText="Modelo" width="80">

								<h:outputText value="#{ntfica.confignot.modelo}" />

							</p:column>

							<p:column headerText="Placa:" width="80">

								<h:outputText value="#{ntfica.confignot.placa}" />

							</p:column>

							<p:column headerText="Cidade:" width="80">

								<h:outputText value="#{ntfica.confignot.cidade}" />

							</p:column>



							<p:column headerText="Velocidade Permitida" width="110">

								<h:outputText value="#{ntfica.velestabelecida}" />

							</p:column>

							<p:column headerText="Velocidade Infração" width="110">

								<h:outputText value="#{ntfica.velocidade}" />

							</p:column>


							<p:column headerText="Data" width="80">
								<h:outputText value="#{ntfica.data}">
									<f:convertDateTime pattern="dd/MM/yyyy" />
								</h:outputText>

							</p:column>


							<p:column headerText="Hora" width="80">

								<h:outputText value="#{ntfica.hora}" />

							</p:column>

							<p:column headerText="Mapa" width="80">



								<a href="#{ntfica.mapa}" target="blank"> Mapa </a>

							</p:column>


						</p:dataTable>

						<h:panelGrid columns="2">

							<h:commandLink>
								<p:graphicImage value="/img/document_pdf.png" />
								<p:dataExporter type="pdf" target="dataTableNoti"
									fileName="Notifica" />
							</h:commandLink>



						</h:panelGrid>
					</h:form>
				</p:dialog>




				<!-- TELA NOTIFICAÇÃO CERCA -->

				<p:dialog header="Notificações de cerca" widgetVar="noticerca"
					showEffect="fade" hideEffect="fade" id="tblcerca" height="600"
					width="950" resizable="false">
					<p:ajax event="close"
						listener="#{mapBean.limparRelatorioNofiticacerca}"
						update="notificaFormcerca" />

					<h:form id="notificaFormcerca">
						<p:growl id="grownotificacerca"></p:growl>
						<h:panelGrid columns="4">
							<h:outputText value="Periodo: ">
							</h:outputText>
							<p:calendar locale="pt" required="true" id="datecerca1"
								requiredMessage="selecione a data "
								value="#{mapBean.datacerca1}"></p:calendar>
							<p:calendar locale="pt" required="true" id="datecerca2"
								requiredMessage="selecione a data "
								value="#{mapBean.datacerca2}"></p:calendar>

							<p:commandButton value="Buscar"
								actionListener="#{mapBean.BuscarNotificacerca}"
								update=":notificaFormcerca:dataTableNoticerca,:notificaFormcerca:grownotificacerca"></p:commandButton>
						</h:panelGrid>

						<p:dataTable var="ntficacerca"
							value="#{mapBean.arrayListNotificacerca}" widgetVar="nt"
							rows="18" paginator="true" id="dataTableNoticerca">

							<p:column headerText="Modelo" width="80">

								<h:outputText value="#{ntficacerca.cerca.imei.modelo}" />

							</p:column>

							<p:column headerText="Placa:" width="80">

								<h:outputText value="#{ntficacerca.cerca.imei.modelo}" />

							</p:column>

							<p:column headerText="Cerca" width="120">

								<h:outputText value="#{ntficacerca.cerca.cidade}" />

							</p:column>



							<p:column headerText="Cidade Violada" width="120">

								<h:outputText value="#{ntficacerca.cidade}" />

							</p:column>


							<p:column headerText="Data" width="80">
								<h:outputText value="#{ntficacerca.data}">
									<f:convertDateTime pattern="dd/MM/yyyy" />
								</h:outputText>

							</p:column>


							<p:column headerText="Hora" width="80">

								<h:outputText value="#{ntficacerca.hora}" />

							</p:column>

							<p:column headerText="Mapa" width="80">



								<a href="#{ntficacerca.localizacao}" target="blank"> Mapa </a>

							</p:column>


						</p:dataTable>

						<h:panelGrid columns="2">

							<h:commandLink>
								<p:graphicImage value="/img/document_pdf.png" />
								<p:dataExporter type="pdf" target="dataTableNoticerca"
									fileName="NotificaCerca" />
							</h:commandLink>



						</h:panelGrid>
					</h:form>
				</p:dialog>






				<!-- CRUD PERMISSAO USUARIO  -->

				<p:dialog header="Cadastro Permissão de Usuário" hideEffect="fade"
					widgetVar="user_per" showEffect="fade" height="450" width="600"
					resizable="false">
					<h:form id="formper">
						<p:growl id="grow_per" showDetail="true" sticky="true" />
						<h:panelGrid columns="2">
							<h:outputLabel>Nome:</h:outputLabel>
							<p:inputText value="#{controllBean.usuarioPer.nome}" size="60"></p:inputText>

							<h:outputLabel>Usuario:</h:outputLabel>
							<p:inputText value="#{controllBean.usuarioPer.email}" size="60"
								required="true" requiredMessage="Usuario "></p:inputText>

							<h:outputLabel>Senha:</h:outputLabel>
							<p:password value="#{controllBean.usuarioPer.senha}" size="60"
								required="true" requiredMessage="Senha obrigatorio"></p:password>

							<h:outputLabel>Telefone:</h:outputLabel>
							<p:inputText value="#{controllBean.usuarioPer.telefone}"
								size="60"></p:inputText>

							<h:outputLabel>Veiculo(s):</h:outputLabel>
							<p:selectCheckboxMenu value="#{controllBean.car}" label="Placa"
								filter="true" filterText="Filter" filterMatchMode="startsWith"
								panelStyle="width:220px">
								<f:selectItems value="#{controllBean.carros}" />
							</p:selectCheckboxMenu>

							<p:commandButton value="Cadastrar"
								actionListener="#{controllBean.cadPerUsuario}"
								update="grow_per,formper"></p:commandButton>
						</h:panelGrid>

						<br></br>
						<br></br>

						<p:dataTable var="usuper"
							value="#{controllBean.listaUsuarioPermitidos}" rows="4"
							paginator="true" id="dataTableper" editable="true">

							<p:ajax event="rowEdit" listener="#{controllBean.onEditPer}"
								update=":formper:grow_per" />

							<p:ajax event="rowEditCancel"
								listener="#{controllBean.onCancelPer}"
								update=":formper:grow_per" />

							<p:column headerText="ID" width="30">
								<h:outputText value="#{usuper.id}" />
							</p:column>

							<p:column headerText="Nome:" width="80">

								<p:cellEditor>
									<f:facet name="output">
										<h:outputText value="#{usuper.nome}" />
									</f:facet>
									<f:facet name="input">
										<p:inputText value="#{usuper.nome}"></p:inputText>
									</f:facet>
								</p:cellEditor>
							</p:column>

							<p:column headerText="Usuario" width="80">
								<p:cellEditor>
									<f:facet name="output">
										<h:outputText value="#{usuper.email}" />
									</f:facet>
									<f:facet name="input">
										<p:inputText value="#{usuper.email}"></p:inputText>
									</f:facet>
								</p:cellEditor>
							</p:column>

							<p:column headerText="Senha" width="80">
								<p:cellEditor>
									<f:facet name="output">
										<h:outputText value="#{usuper.senha}" />
									</f:facet>
									<f:facet name="input">
										<p:inputText value="#{usuper.senha}"></p:inputText>
									</f:facet>
								</p:cellEditor>
							</p:column>

							<p:column headerText="Telefone" width="80">
								<p:cellEditor>
									<f:facet name="output">
										<h:outputText value="#{usuper.telefone}" />
									</f:facet>
									<f:facet name="input">
										<p:inputText value="#{usuper.telefone}"></p:inputText>
									</f:facet>
								</p:cellEditor>
							</p:column>



							<p:column headerText="Opções" style="width:50px">
								<p:rowEditor />
							</p:column>


						</p:dataTable>

					</h:form>


				</p:dialog>




				<!-- RELATORIO DE ROTA  -->

				<p:dialog header="RELATORIO DE ROTA" widgetVar="relatorio_rota"
					hideEffect="fade" showEffect="fade" height="610" width="860"
					resizable="false">
					<p:ajax event="close" listener="#{relatorioMapBean.handleClose}" />
					<h:form id="dadosRelatorio">
						<p:growl id="Find" />
						<h:panelGrid columns="7">

							<h:outputText value="Veiculo:"></h:outputText>
							<p:selectOneMenu value="#{relatorioMapBean.imei.placa}"
								effect="fold" required="true" editable="true" id="carros"
								requiredMessage="Selecione Placa do veiculo">
								<f:selectItem itemLabel="Selecione o veiculo" itemValue="" />
								<f:selectItems value="#{controllBean.carros}" />
							</p:selectOneMenu>

							<h:outputText value="Data:"></h:outputText>
							<p:calendar value="#{relatorioMapBean.dataAgora}" locale="pt"
								required="true" id="popupButtonCal"
								requiredMessage="selecione a data " />

							<h:outputText value="Hora:"></h:outputText>
							<p:calendar value="#{relatorioMapBean.horaRelatorio}"
								pattern="HH:mm" timeOnly="true" required="true"
								requiredMessage="Selecione horario inicial" />

							<p:commandLink update=":formRelatorioMap,Find" title="Buscar"
								actionListener="#{relatorioMapBean.buscarposicaoRelatoiro}">
								<p:graphicImage value="/img/1352313290_explorer.png"></p:graphicImage>

							</p:commandLink>




						</h:panelGrid>
					</h:form>

					<h:form id="formRelatorioMap">
						<p:panel>
							<p:growl id="map" />
							<p:gmap
								center="#{relatorioMapBean.decimalflat},#{relatorioMapBean.decimalflong}"
								zoom="#{relatorioMapBean.zom}" type="ROADMAP" id="mapaRelatorio"
								model="#{relatorioMapBean.advancedModelRelatorio}"
								style="width:800px;height:440px">

							</p:gmap>

							<h:panelGrid columns="6" cellpadding="5">
								<h:outputText value="DISTÂNCIA PERCORRIDA:  "
									styleClass="estiloMensagem2"></h:outputText>
								<h:outputText value=" #{relatorioMapBean.totalPercorridoS} Km"
									id="vlor" styleClass="estiloMensagem" />

								<h:outputText value="TEMPO DO PERCURSO:  "
									styleClass="estiloMensagem2"></h:outputText>
								<h:outputText value=" #{relatorioMapBean.tempoRealPercurso} "
									styleClass="estiloMensagem" />

								<h:outputText value="VELOCIDADE ATUAL:  "
									styleClass="estiloMensagem2"></h:outputText>
								<h:outputText value=" #{relatorioMapBean.velocidadeAtual} Km/h"
									styleClass="estiloMensagem" />
							</h:panelGrid>


							<p:poll interval="3" listener="#{relatorioMapBean.play}"
								update="formRelatorioMap,map" id="AtualizarPonto"
								stop="#{relatorioMapBean.stop}" />

						</p:panel>





						<div align="center">
							<table id="buton">
								<tr>

									<td><p:commandLink
											actionListener="#{relatorioMapBean.parar}"
											update="AtualizarPonto">
											<p:graphicImage value="/img/button_pause.png" width="45"
												height="45"></p:graphicImage>
										</p:commandLink></td>

									<td><p:commandLink
											actionListener="#{relatorioMapBean.iniciar}"
											update="formRelatorioMap">
											<p:graphicImage value="/img/button_play.png" width="45"
												height="45"></p:graphicImage>
										</p:commandLink></td>




								</tr>
							</table>


						</div>

					</h:form>

				</p:dialog>



				<p:dialog header="Notificação de velocidade" width="800"
					hideEffect="fade" height="400" widgetVar="conf" resizable="false"
					showEffect="fade">
					<h:form id="formNot">
						<p:growl id="msg" />

						<table>
							<tr>
								<td><h:panelGrid columns="1">
										<h:outputLabel>Selecione Veiculo(s):</h:outputLabel>
										<p:selectCheckboxMenu value="#{notificaBean.car}"
											required="true" label="Placa" filter="true"
											filterText="Filter" filterMatchMode="startsWith"
											panelStyle="width:220px">
											<f:selectItems value="#{controllBean.carros}" />
										</p:selectCheckboxMenu>
									</h:panelGrid></td>

								<td><h:panelGrid columns="1">
										<h:outputText value="Velocidade Maxima Permitida  Km/h"></h:outputText>

										<p:inputText id="txt5" value="#{notificaBean.vmax}" size="10" />
										<p:slider for="txt5" maxValue="120" step="10" required="true">
											<p:ajax event="slideEnd" />
										</p:slider>
									</h:panelGrid></td>

							</tr>

							<tr>
								<td><h:outputText value="Formas de Notificação"></h:outputText>

								</td>

							</tr>

							<tr>
								<td><h:panelGrid columns="3">

										<h:outputText value="EMAIL:"></h:outputText>
										<p:inputText size="40" value="#{notificaBean.emailnf}"
											required="true"></p:inputText>

										<p:selectBooleanButton value="#{notificaBean.value2}"
											onLabel="Habilitado" offLabel="Desabilitado"
											onIcon="ui-icon-check" offIcon="ui-icon-close">
											<p:ajax update="msg" listener="#{notificaBean.addMessage}" />
										</p:selectBooleanButton>


										<h:outputText value="SMS"></h:outputText>
										<p:inputText disabled="true" size="40"></p:inputText>

									</h:panelGrid>
								</td>

							</tr>


						</table>
						<br></br>
						<br></br>

						<p:commandButton value="Cadastrar"
							actionListener="#{notificaBean.cadastrarNoti}"
							update="msg,dataTablenot,formNot">


						</p:commandButton>


						<br></br>
						<br></br>


						<p:dataTable var="noti" value="#{notificaBean.confs}" rows="3"
							paginator="true" id="dataTablenot" editable="true"
							selection="#{notificaBean.confselecionada}"
							selectionMode="single" rowKey="#{noti.id}">

							<p:ajax event="rowSelect" listener="#{notificaBean.onRowSelect}"
								update=":velFormEdit:display" oncomplete="notvel.show()" />


							<p:column headerText="Placa:" width="60">

								<h:outputText value="#{noti.placa}" size="120" />

							</p:column>

							<p:column headerText="Cidade" width="80">

								<h:outputText value="#{noti.cidade}" size="120" />

							</p:column>

							<p:column headerText="Email" width="150">

								<h:outputText value="#{noti.email}" width="160" />

							</p:column>

							<p:column headerText="Notif. Email" width="120">

								<h:outputText value="#{noti.emailboolean}" />

							</p:column>

							<p:column headerText="Velocidade Max" width="80">

								<h:outputText value="#{noti.veloxmax}" />

							</p:column>


						</p:dataTable>



					</h:form>


					<p:dialog header="Editor Notificação de velocidade"
						hideEffect="fade" widgetVar="notvel" width="400" height="200"
						resizable="false" showEffect="fade">
						<h:form id="velFormEdit">
							<h:panelGrid id="display" columns="2">

								<h:outputLabel>Veiculo:</h:outputLabel>
								<h:inputText value="#{notificaBean.confselecionada.modelo}"
									size="40" disabled="true"></h:inputText>

								<h:outputLabel>Placa</h:outputLabel>
								<h:inputText value="#{notificaBean.confselecionada.placa}"
									size="40" disabled="true"></h:inputText>


								<h:outputLabel>Velocidade Max.:</h:outputLabel>
								<h:inputText value="#{notificaBean.confselecionada.veloxmax}"
									size="40"></h:inputText>

								<h:outputLabel>Email:</h:outputLabel>
								<h:inputText value="#{notificaBean.confselecionada.email}"
									size="40" required="true"></h:inputText>

								<p:selectBooleanButton value="#{notificaBean.value2}"
									onLabel="Habilitado" offLabel="Desabilitado"
									onIcon="ui-icon-check" offIcon="ui-icon-close">

								</p:selectBooleanButton>
							</h:panelGrid>
							<br></br>
							<p:commandButton value="Atualizar"
								actionListener="#{notificaBean.updateNotifica}"
								update=":formNot:dataTablenot,:formNot:msg "
								oncomplete="notvel.hide()">
							</p:commandButton>
							<p:commandButton value="Excluir"
								actionListener="#{notificaBean.deleteNotifica}"
								update=":formNot:dataTablenot,:formNot:msg "
								oncomplete="notvel.hide()">
							</p:commandButton>

						</h:form>


					</p:dialog>



				</p:dialog>



				<!-- MENU LATERAL  -->

				<h:form>

					<p:stack id="teste" icon="/img/stack/stack.png" expanded="true">

						<p:menuitem value="Velocidade" oncomplete="conf.show();"
							rendered="#{login.per}" icon="/img/stack/system.png" />
						<p:menuitem value="Veiculo" icon="/img/stack/keychain_access.png"
							onclick="veiculo.show();" rendered="#{login.menu}" />
						<p:menuitem value="Usuario" icon="/img/stack/group.png"
							rendered="#{login.menu}" onclick="user.show();" />
						<p:menuitem value="Permissão" icon="/img/stack/group.png"
							rendered="#{login.per2}" onclick="user_per.show();" />
						<p:menuitem value="Cerca" icon="/img/stack/maps.png"
							rendered="#{login.per}" onclick="cerca.show();" />
						<p:menuitem value="Localização" icon="/img/stack/04_maps.png"
							onclick="rota.show();" />
					</p:stack>


				</h:form>




			</p:layoutUnit>


		</p:layout>



	</h:body>
</f:view>
</html>